#include <iostream>
#include <vector>
#include <memory>

using namespace std;

class Widget{
public:
    void process();
    ~Widget(){
        cout << "kill me" << endl;
    }
};

vector<shared_ptr<Widget>> vec;

void Widget::process(){
    vec.emplace_back(this);
}


int main(){
    Widget* w = new Widget();
    
        cout << "1----------------" << endl;
        vec.emplace_back(w);
        vec.emplace_back(w);
        cout << "2----------------" << endl;
        delete w;
        vec.pop_back();
        cout << "3----------------" << endl;
        vec.pop_back();
        cout << "4----------------" << endl;
    
    cout << "hello" << endl;

    

    return 0;
}